<template>
  <div class="box-bpdy box-primary">
    <div class="form-horizontal">
      <div class="box-body">
        <div class="form-group">
          <label class="col-md-2 control-label my-label">单位名称</label>
          <div class="col-sm-10">
            <input class="form-control" v-model="ebaseInfo.name" placeholder="单位名称" v-bind:readonly="isReadOnly">
          </div>
        </div>
        <div class="form-group">
          <label class="col-md-2 control-label my-label">单位地址</label>
          <div class="col-sm-10">
            <input class="form-control" v-model="ebaseInfo.address" placeholder="单位地址" v-bind:readonly="isReadOnly">
          </div>
        </div>
        <div class="form-group">
          <label class="col-md-2 control-label my-label">邮编</label>
          <div class="col-sm-4">
            <input class="form-control" v-model="ebaseInfo.zipcode" placeholder="邮编" v-bind:readonly="isReadOnly">
          </div>
          <label class="col-md-2 control-label my-label">区号</label>
          <div class="col-sm-4">
            <input class="form-control" v-model="ebaseInfo.areacode" placeholder="区号" v-bind:readonly="isReadOnly">
          </div>
        </div>
        <div class="form-group">
          <label class="col-md-2 control-label my-label">传真</label>
          <div class="col-sm-4">
            <input class="form-control" v-model="ebaseInfo.fax" placeholder="传真号码" v-bind:readonly="isReadOnly">
          </div>
          <label class="col-md-2 control-label my-label">值班</label>
          <div class="col-sm-4">
            <input class="form-control" v-model="ebaseInfo.tel" placeholder="值班号码" v-bind:readonly="isReadOnly">
          </div>
        </div>
      </div>
    </div>
  </div>
</template>
<script>
export default {
  name: 'DepartBaseInfo',
  props: ['baseInfo', 'isReadOnly'],
  data: function() {
    return {
      ebaseInfo: {
        id:0,
        name: '',
        address: '',
        zipcode: '',
        areacode: '',
        fax: '',
        tel: ''
      }
    }
  },
  mounted: function() {
    if (this.baseInfo) {
      this.ebaseInfo = this.baseInfo
    }
  },
  methods: {
    setData: function(data) {
      this.ebaseInfo = data
    },
    getData: function() {
      let newData = {}
      newData.name =  this.ebaseInfo.name
      newData.address=this.ebaseInfo.address
      newData.zipcode=this.ebaseInfo.zipcode
      newData.areacode=this.ebaseInfo.areacode
      newData.fax=this.ebaseInfo.fax
      newData.tel=this.ebaseInfo.tel
      return newData
    },
    clearData(){
      for(var prop in this.ebaseInfo){
        this.ebaseInfo[prop] = ''
      }
    }
  }
}
</script>
<style >

</style>

